package com.nhncorp.pleiades.protocol;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

import com.nhncorp.pleiades.hadoop.Writable;
import com.nhncorp.pleiades.hadoop.WritableUtils;

public class AdminLockInfo implements Writable {
  
  private String serviceId;
  private String owner;
  private String lockId;
  
  public AdminLockInfo() {
    new AdminLockInfo("", "", "");
  }
  
  public AdminLockInfo(String serviceId, String owner, String lockId) {
    this.serviceId = serviceId;
    this.owner = owner;
    this.lockId = lockId;
  }

  
  public void readFields(DataInput in) throws IOException {
    this.serviceId = WritableUtils.readString(in);
    this.owner = WritableUtils.readString(in);
    this.lockId = WritableUtils.readString(in);
  }

  
  public void write(DataOutput out) throws IOException {
    WritableUtils.writeString(out, serviceId);
    WritableUtils.writeString(out, owner);
    WritableUtils.writeString(out, lockId);
  }

  public String getServiceId() {
    return serviceId;
  }

  public void setServiceId(String serviceId) {
    this.serviceId = serviceId;
  }

  public String getOwner() {
    return owner;
  }

  public void setOwner(String owner) {
    this.owner = owner;
  }

  public String getLockId() {
    return lockId;
  }

  public void setLockId(String lockId) {
    this.lockId = lockId;
  }
  
  public String toString() {
    return owner + "," + serviceId + "," + lockId;
  }

}
